﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace DataFileApplication_WPF.Common
{
    public class MultiBindingToButtonEnableConverter : IMultiValueConverter
    {
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            // values 里每个元素都是 bool，true=有错，false=无错
            foreach (var v in values)
            {
                if (v is bool b && b)
                    return false; // 有任何一个控件有错，按钮不可用
            }
            return true; // 全部无错，按钮可用
        }


        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
